<?php echo $this->load->view('meta'); ?>
<link rel="stylesheet" href="<?=base_url()?>css/admin.css" type="text/css" media="screen" />
<title>xa-ncsu | calendar</title>
<link rel="stylesheet" href="<?=base_url()?>css/impromptu.css" type="text/css" media="screen" />
<script type="text/javascript" src="<?=base_url();?>js/jquery-impromptu.1.2.js"></script>
<script>
function vhconfirm(v,m)
        {
            if( v )
            {
                var f =  document.createElement("form");document.body.appendChild(f);f.method = "POST";f.action = $("#" + v ).attr( "href" );f.submit();
            } else
            {
                return false;
            }
        }
</script>
<?php echo $this->load->view('header'); ?>
<ul class="nav-list">
	<li><?=anchor('calendar/full', 'view calendar');?></li>
	<li class="last"><?=anchor('calendar/create', 'create a new event');?></li>
</ul>
<div id="replace_me"></div>
<?php if ($events->num_rows() > 0): ?>
<table>	
	<tr>
		<th>name</th>
		<th>description</th>
		<th>location</th>
		<th>start</th>
		<th>end</th>
		<th>category</th>
		<th>items</th>
		<th>actions</th>
	</tr>
<?php foreach ($events->result() as $events): ?>
<tr>
	<td><?=$events->name?></td>
	<td><?=$events->description?></td>
	<td><?=$events->location?></td>
	<td><?=$events->start?></td>
	<td><?=$events->end?></td>
	<td><?=$events->category?></td>
	<td><?=anchor('calendar/event_items/' . $events->id, $events->num_items);?></td>
	<td><a href="<?=site_url();?>calendar/editEvent/<?=$events->id?>"><img src="<?=base_url();?>img/icons/page_edit.png" alt="Edit Post" />
	<a href="<?=site_url();?>calendar/deleteEvent/<?=$events->id?>"	 id="conf<?=$events->id?>" onclick="$.prompt('Delete Event?',{callback: vhconfirm, buttons: { Yes : 'conf<?=$events->id?>', No : false}}); return false;">
			<img src="<?=base_url();?>img/icons/delete.png" alt="Delete Event" title="Delete Event" /></a></td>
</tr>
<?php endforeach; ?>
<?php endif; ?>
</table>
<?php echo $this->load->view('footer'); ?>